This example uses the HTML DOM to assign "ondragstart", "ondrag", "ondragover" and "ondrop" events to the document object.

Drag the p element back and forth between the two rectangles:

Drag me!

Note: drag events are not supported in Internet Explorer 8 and earlier versions or Safari 5.1 and earlier versions.